Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(playground): add tools ui #5002

Merged
merged 15 commits into from
Oct 15, 2024
Merged

Conversation

Parker-Stafford
Copy link
Contributor

@Parker-Stafford Parker-Stafford commented Oct 14, 2024

resolves #4902

Screen.Recording.2024-10-15.at.10.53.34.AM.mov

with choice selector
image

app/src/components/code/JSONToolEditor.tsx Outdated Show resolved Hide resolved
linter(jsonParseLinter()),
linter(jsonSchemaLinter(), { needsRefresh: handleRefresh }),
jsonLanguage.data.of({
autocomplete: jsonCompletion(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool

"theme" | "extensions" | "editable"
>;

export function JSONToolEditor(props: JSONToolEditorProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this really JSONEditor with json schema added on top?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah i had baked in the tool schema, so that's what makes it "tool" I guess but i could either

  • modify the json editor to accept a schema and conditionally add the extensions or
  • make a new jsoneditorwithschema (still would need to take in a schema as a prop)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed and extended the jsonEditor

@Parker-Stafford Parker-Stafford marked this pull request as ready for review October 15, 2024 17:57
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 15, 2024
<div
key={i}
key={instance.id}
css={css`
flex: 1 1 0px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some flex gap?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh yes thank you i saw this then forgot to circle back

@mikeldking mikeldking force-pushed the parker/4902-playground-tools-ui branch from 82cab7a to bedd86b Compare October 15, 2024 19:59
jsonSchemaLinter,
stateExtensions,
} from "codemirror-json-schema";
import { JSONSchema7 } from "json-schema";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the 7 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the version of the json schema spec i believe

Comment on lines +39 to +45
const toolNames = useMemo(
() =>
tools
.map((tool) => tool.definition.function?.name)
.filter((name): name is NonNullable<typeof name> => name != null),
[tools]
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note there's a slight bug here if the names collide

Copy link
Contributor

@mikeldking mikeldking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool

@mikeldking mikeldking merged commit 767bd37 into playground Oct 15, 2024
4 checks passed
@mikeldking mikeldking deleted the parker/4902-playground-tools-ui branch October 15, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants